import request from '@/utils/request'

/**
 * @description 列表
 * @param data
 * @returns
 */
export const getCategoryListApi: IGetCategoryListApi = function (params) {
  return request.get('htscrm/category/list', { params });
};

/**
 * @description 所有数据
 * @param params
 * @returns
 */
export const getCategoryAllApi: IGetCategoryAllApi = function(params) {
  return request.get(`htscrm/category/all`, { params })
}

/**
 * @description 详情
 * @param data
 * @returns
 */
export const getCategoryDetailApi: IGetCategoryDetailApi = function (id) {
  return request.get(`htscrm/category/info/${id}`);
};

/**
 * @description 添加
 * @param data
 * @returns
 */
export const addCategoryApi: IAddCategoryApi = function (data) {
  return request.post('htscrm/category/add', data);
};

/**
 * @description 编辑
 * @param data
 * @returns
 */
export const updateCategoryApi: IUpdateCategoryApi = function (data) {
  return request.post(`htscrm/category/edit/${data.id}`, data);
};

/**
 * @description 删除
 * @param data
 * @returns
 */
export const deleteCategoryApi: IDeleteCategoryApi = function (id) {
  return request.post(`htscrm/category/del/${id}`);
};

/**
 * @description 获取分类标签
 * @param data
 * @returns
 */
export const getCategoryTagApi:IGetCategoryTagApi = function () {
  return request.get(`htscrm/tag/by_group`);
};

/**
 * @description 获取分类标签
 * @param data
 * @returns
 */
export const getCategoryTagInfoApi:IGetCategoryTagInfoApi = function (id, data) {
  return request.post(`htscrm/category/tag/${id}`, data);
};

/**
 * @description 详情
 * @param data
 * @returns
 */
export const getCategoryBindInfoApi: IGetCategoryBindInfoApi = function (id) {
  return request.get(`htscrm/category/bind_info/${id}`);
};

/**
 * @description 详情
 * @param data
 * @returns
 */
export const setCategoryBindInfoApi: ISetCategoryBindInfoApi = function (id, data) {
  return request.post(`htscrm/category/bind/${id}`, data);
};